﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using QuanLyNhaSach.QuanLyNhaSachDTO;
namespace QuanLyNhaSach.QuanLyNhaSachDao
{
    class BaoCaoTonDao
    {
        public static void Insert(BaoCaoTonDTO bc)
        {
            bool active = true;
            string sql = "insert into BaoCaoTon(MaSach,NgayPhatSinh,TonDau,PhatSinh,TonCuoi,Active) values(" + bc.MaSach + ",'" + bc.NgayPhatSinh + "'," + bc.TonDau + ",'" + bc.PhatSinh + "'," + bc.TonCuoi + "," + active + ")";
            Database.ExcuNonQuery(sql);
        }
        public static DataTable BaoCaoThang(int thang)
        {
            string sql = "select MaSach,TonDau,PhatSinh,TonCuoi from BaoCaoTon where Month(NgayPhatSinh) = '" + thang + "'";
            return Database.ExcuQuery(sql);
        }
        public static string MaSach(int thang)
        {
            DataTable dt;
            string sql = "select MaSach from BaoCaoTon where Month(NgayPhatSinh) = '" + thang + "'";
           dt=Database.ExcuQuery(sql);
           string a = dt.Rows[0]["MaSach"].ToString();
           return a;
        } 
    }
}
